1 Motiavtion & Goal

Although the main purpose of making film is entertainment, not earning enough profit puts filmmakers in an awkward situation that makes it difficult to keep producing high-quality movies. One most popular quality metric is the score from Internet Movie Database (IMDb). Based on the movie metadata from IMDb, it would be interesting to analyze what makes a movie more successful than another, commercially and/or critically. So, the main goal of this project is to explore the IMDb dataset with focus on profit and IMDb score and present the findings in an intuitive and interactive way. And, if possible, to identify what features contribute to a highly rated/profitable film most significantly and try to predict a movie’s profitability.

These are the R packages required for this project.

library(tidyverse)
library(knitr)
library(plotly)
library(ggrepel)
library(DT)
library(tm)
library(openxlsx)

2 Data Sources & Preparation

The dataset used in this project came from the IMDb 5000 Movie Dataset from Kaggle. It recorded information on more than 5000 movies across 66 countries from 1916 to 2016. The dataset is available in a csv format file and is of size 1MB. Note that the original dataset is replaced on Kaggle website, and therefore I cannot access the original one. The following link is where I sourced the same data from: https://www.kaggle.com/carolzhangdc/imdb-5000-movie-dataset (Yueming Zhang 2017). The data preparation part consists of the following tasks:

  1. Import the data.
  2. Clean and tidy up the data to ensure its quality and make it easy to analyze.
  3. Provide detailed data description.

2.1 Load Data

Import the data and show the dimension and names of all attributes of the data. WThere are 5043 movies recorded in this dataset, and each record has 28 attributes., including information such as Title of the movie, Name of the movie director, Country the movie was produced in, Budget of the movie (in USD), Profitability, and IMDB score for the movie.

## [1] 5043   28
##  [1] "color"                     "director_name"            
##  [3] "num_critic_for_reviews"    "duration"                 
##  [5] "director_facebook_likes"   "actor_3_facebook_likes"   
##  [7] "actor_2_name"              "actor_1_facebook_likes"   
##  [9] "gross"                     "genres"                   
## [11] "actor_1_name"              "movie_title"              
## [13] "num_voted_users"           "cast_total_facebook_likes"
## [15] "actor_3_name"              "facenumber_in_poster"     
## [17] "plot_keywords"             "movie_imdb_link"          
## [19] "num_user_for_reviews"      "language"                 
## [21] "country"                   "content_rating"           
## [23] "budget"                    "title_year"               
## [25] "actor_2_facebook_likes"    "imdb_score"               
## [27] "aspect_ratio"              "movie_facebook_likes"

Here is the preview the raw data.

2.2 Data Tidying & Cleansing

In order to get the data ready for analysis, some tidying and cleansing works need to be done. First, unnecessary characters in the movie_title, genre and plot_keyword columns were removed.

Second, duplicates in the data in movie_title column were removed as they may affect later analysis. In total, 126 duplicate movies were removed.

## [1] 126

Third, columns that contain currency, such as the budget and gross, may cause problems in later analysis because a few countries were not converted to US dollars, including “South Korea”, “Japan”, “Thailand”, …, etc. Furthermore, given that all of them are converted to US dollars, we still need to consider the inflation, and this makes the problem even more complicated. Thus, only movies from USA were kept for profitability analysis.

## # A tibble: 4,917 x 4
##    movie_title                 budget country        gross
##    <chr>                        <dbl> <chr>          <int>
##  1 Lady Vengeance          4200000000 South Korea   211667
##  2 Fateless                2500000000 Hungary       195888
##  3 Princess Mononoke       2400000000 Japan        2298191
##  4 Steamboy                2127519898 Japan         410388
##  5 Akira                   1100000000 Japan         439162
##  6 Godzilla 2000           1000000000 Japan       10037390
##  7 Kabhi Alvida Naa Kehna   700000000 India        3275443
##  8 Tango                    700000000 Spain        1687311
##  9 Kites                    600000000 India        1602466
## 10 Red Cliff                553632000 China         626809
## # ... with 4,907 more rows

Then, an new column profitable was added to indicate if a movie is profitable, ‘1’ means profitable (that is, profit \(>\) budget). As this involving both gross and budget columns, only movies from USA have non-empty value for this column. This version of data is also saved to an Excel file for people who want to focus only on USA films.

Last, ragarding records that contain missing values, to keep the entire dataset as complete as possible, I decided to not remove any rows with missing data and to handle this issue for each individual analysis. For example, when doing genre-wise analysis, those without values for genre variables are excluded from the analysis.

Columns that contain most “NA” entries are gross, budget, and aspect_ratio.

## # A tibble: 30 x 2
##    `Column Name`           NA_Count
##    <chr>                      <int>
##  1 gross                        863
##  2 budget                       484
##  3 aspect_ratio                 326
##  4 title_year                   106
##  5 director_facebook_likes      102
##  6 num_critic_for_reviews        49
##  7 actor_3_facebook_likes        23
##  8 num_user_for_reviews          21
##  9 duration                      15
## 10 facenumber_in_poster          13
## # ... with 20 more rows

Finishing the cleaning process, check dimesnion and list columns names of the cleaned data. Then, save it to an csv file.

## [1] 4917   30
##  [1] "color"                     "director_name"            
##  [3] "num_critic_for_reviews"    "duration"                 
##  [5] "director_facebook_likes"   "actor_3_facebook_likes"   
##  [7] "actor_2_name"              "actor_1_facebook_likes"   
##  [9] "gross"                     "genres"                   
## [11] "actor_1_name"              "movie_title"              
## [13] "num_voted_users"           "cast_total_facebook_likes"
## [15] "actor_3_name"              "facenumber_in_poster"     
## [17] "plot_keywords"             "movie_imdb_link"          
## [19] "num_user_for_reviews"      "language"                 
## [21] "country"                   "content_rating"           
## [23] "budget"                    "title_year"               
## [25] "actor_2_facebook_likes"    "imdb_score"               
## [27] "aspect_ratio"              "movie_facebook_likes"     
## [29] "genres_new"                "plot_keywords_new"

Note that, after all the preprocessing, there are 3768 rows that do not have any missing value and they are also saved to an Excel sheet.

## [1] 3700

2.3 Data Description

The following table lists the name, type, and description of each variable in the dataset.

Name Type Description
color character Colorization: Color or Black and White
director_name character Name of the director
num_critic_for_reviews integer Number of Critical Reviews
duration integer Duration of the movie in Minutes
director_facebook_likes integer Number of FB Page Likes of Director
actor_3_facebook_likes integer Number of FB Page Likes of Actor No.3
actor_2_name character Name of Actor No.2
actor_1_facebook_likes integer Number of FB Page Likes of Actor No.1
gross integer Gross Earned in US Dollars
genres character Classification: Action, Comedy, Drama, …, etc.
actor_1_name character Name of Actor No.1
movie_title character Title of the Movie
num_voted_users integer Number of Voted Users on IMDB
cast_total_facebook_likes integer Total FB Page Likes of of the Entire Cast
actor_3_name character Name of Actor No.3
facenumber_in_poster integer Number of the Actors Featured in the Movie Poster
plot_keywords character Keywords Describing the Plot
movie_imdb_link character IMDB Link of the Movie
num_user_for_reviews integer Number of Users who Reviewed the Movie
language character Language of the movie: English, French, Chinese, …, etc.
country character Country where the Movie was Produced
content_rating character Content rating
budget double Budget in US Dollars
title_year integer Year of Release
actor_2_facebook_likes integer Number of FB Page Likes of Actor No.2
imdb_score double IMDB Score on a Scale of 1 to 10
aspect_ratio double Aspect Ratio
movie_facebook_likes integer Number of FB Page Likes of the Film
genres_new character Edited genres
plot_keywords_new character Edited plot_keywords

3 Exploratory Data Analysis

The analysis involves four main aspects: Genre, Country, IMDB score, and Profitability.

3.1 Genre-wise Analysis

Since most of movies in this dataset were categorized as multiple genres, some preprocessing on the genres must be done before actually analyzing the data.

3.1.1 Genres Preprocessing

First, the document-term matrix for genres was constructed using the package “TM”.

## <<DocumentTermMatrix (documents: 4917, terms: 26)>>
## Non-/sparse entries: 14127/113715
## Sparsity           : 89%
## Maximal term length: 11
## Weighting          : term frequency (tf)

Then, the created document-term matrix was used to calculate frequency for each genre.

## # A tibble: 26 x 2
##    genre     count
##    <chr>     <dbl>
##  1 drama      2533
##  2 comedy     1847
##  3 thriller   1364
##  4 action     1113
##  5 romance    1084
##  6 adventure   888
##  7 crime       868
##  8 sci-fi      594
##  9 fantasy     583
## 10 horror      539
## # ... with 16 more rows

3.1.2 Genres Distribution

After preprocessing was done, we can start doing analysis about the genres data. First, we try to find which genres are used the most. By plotting distribution of genres frequency, we can see that the top 5 movie genres are “Drama”, “Comedy”, “Thriller”, “Action”, and “Romance”.

3.1.3 Genres vs. Profitability

Now, we want to identify which genre tend to have higher budget/gross/profit. As mentioned previously, this part involves movies only from USA due to the currency conversion issue.

First, we calculate the average budget, gross, and profit (= gross - budget) for each genre.

## # A tibble: 23 x 4
##    genres_new  mean_gross mean_budget mean_profit
##    <chr>            <dbl>       <dbl>       <dbl>
##  1 Action       85881165.   70503681.   15377484.
##  2 Adventure   107588235.   80902013.   26686222.
##  3 Animation   120847003.   85607853.   35239151.
##  4 Biography    46089398.   29135662.   16953735.
##  5 Comedy       54540529.   35059454.   19481075.
##  6 Crime        44945166.   33948142.   10997025.
##  7 Documentary  14683626.    4021501.   10662126.
##  8 Drama        42460107.   29585071.   12875036.
##  9 Family       94310623.   64866065.   29444559.
## 10 Fantasy      90539880.   66073493.   24466387.
## # ... with 13 more rows

Then, we compared them using a grouped bar chart sorted by a descending order of the mean profit. From the plot, we can find a few things:

  1. Top 3 most profitable genres are “Animation”, “Family”, and “Musical”.
  2. In general, films of genres of bigger budget (\(> \$80M\)) tend to earn more profit, with “Action” being the only exception.
  3. Low-budget films of genres such as “Musical” and “Comedy” are really good investments.
  4. All the top 5 popular genres (“Drama”, “Comedy”, “Thriller”, “Action”, and “Romance”) have average profit less than \(\$20M\).

3.3 IMDB Score Analysis

In here, I tried to see which kind of movies are more successful in terms of the IMDB ratings.

We first start by looking at the basic central tendency (mean) and the variation in movie score. Therefore, a histogram of IMDB score which also has the 5th and 95th percentile mark for the IMDB score.

We first calculate some summary statistics of IMDB score. We can see that the mean IMDB Score is 6.4 and 90% of movies have a score between 8.1 and 4.3. IMDB scores follow a bell shaped distribution. So any movie having a score of more than 8.1 would be one of the top 5% movies in the world.

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.600   5.800   6.600   6.438   7.200   9.500

IMDB score distribution.

3.3.1 IMDB vs. Profitabilty

In order to understand the relationship between IMDB score, profit and budget, I first plotted a 3-Dimensional scatter plot using the popular visualization package “plotly” to try to have a big picture about it. The result is an interactive plot, which makes it easier for us to observe the relationship between them. As previously discussed, this analysis only includes movies from USA.

From the plot, we can see that movies with higher IMDB score tend to have higher profit and significant number of movies end up losing money. Intuitively, IMDB score and groos might be correlated as people are more willing to watch famous and highly-rated movies.

3.3.1.1 Commercial Success v.s. Critical Acclaim

However, as people may be more interested in those films with huge commerical success, the top 30 profitable films were plotted as well as their gross and IMDB scores, where the vertical and the horizontal line refers to the median gross and the median IMDB score. Note that the bigger the point is, the more profit it has made. It follows that, when taking a closer look at relationship of these films with their IMDB ratings, there is little correlation found between them. This is as expected since most highly-rated films don’t do well on box office.

These are the top 30 movies with highest Profit, along with its profit and Return on Investment. Note that the bigger a point is, the higher its ROI is. For movies with budget over 70 millions dollars, we can observe an upward trend close to linear, which can be inferred that bigger-budget movies tend to earn more profit. However, there’s a downward trend when the budget is less than 70 millions dollars. Having a closer look at movies in this region, I found most of them produced in the 80s or early 90s, and so, their true budget should be higher with inflation being taken into consideration.

3.3.1.2 Return on Investment as Profitability

Nonetheless, the profit earned does not give a whole picture about financial success of a movie throughout the years, so “Return on Investment (ROI)” is used to provide a different perspective about a movie’s profitability. The following is top 30 Movies with highest Return on Investment for movies of at least 10 millions dollars budget. As expected, films with smaller budget have higher ROI and the ROI decreases as the budget grows bigger. Yet, we can see that the ROIs for movies with over \(\$50M\) budget do not differ much.

3.4 Regression Analysis

3.5 Some Interesting Facts

Top 10 movies with highest IMDB score.

## # A tibble: 13 x 2
##    movie_title                                      avg_imdb
##    <chr>                                               <dbl>
##  1 "Towering Inferno             "                       9.5
##  2 "The Shawshank Redemption "                           9.3
##  3 "The Godfather "                                      9.2
##  4 "Dekalog             "                                9.1
##  5 "Kickboxer: Vengeance "                               9.1
##  6 "Fargo             "                                  9  
##  7 "The Dark Knight "                                    9  
##  8 "The Godfather: Part II "                             9  
##  9 "12 Angry Men "                                       8.9
## 10 "Pulp Fiction "                                       8.9
## 11 "Schindler's List "                                   8.9
## 12 "The Good, the Bad and the Ugly "                     8.9
## 13 "The Lord of the Rings: The Return of the King "      8.9

Top 10 directors with highest average IMDB score.

## # A tibble: 10 x 2
##    director_name    avg_imdb
##    <chr>               <dbl>
##  1 John Blanchard        9.5
##  2 Cary Bell             8.7
##  3 Mitchell Altieri      8.7
##  4 Sadyk Sher-Niyaz      8.7
##  5 Charles Chaplin       8.6
##  6 Mike Mayhall          8.6
##  7 Damien Chazelle       8.5
##  8 Majid Majidi          8.5
##  9 Raja Menon            8.5
## 10 Ron Fricke            8.5

References

Yueming Zhang. 2017. IMDB 5000 Movie Dataset | Kaggle. https://www.kaggle.com/carolzhangdc/imdb-5000-movie-dataset.